﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
   <meta charset="utf-8" />
  	  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dreamer CMS - 后台管理系统</title> 
    <link href="/resource/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/resource/css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="row">
    <div class="col-md-12">
    	<h1 class="panel-heading">编辑用户</h1>
        <!--breadcrumbs start -->
        <ul class="breadcrumb">
			<li><a href="/admin/dashboard/toIndex"><i class="fa fa-home"></i> 首页</a></li>
			<li class="active">编辑用户</li>
		</ul>
        <!--breadcrumbs end -->
    </div>
</div>
<section class="panel">
	<div class="panel-body">
		<form class="col s12" id="form1" enctype="multipart/form-data" th:action="@{/admin/user/update}" onsubmit="return validateForm();" method="post">
			<input type="hidden" th:value="${user.id}" id="id" name="id"/>
			<div class="form-group form-control-medium">
				<label for="username">用户名：</label>
				<input id="username" name="username" type="text" th:value="${user.username}" class="form-control" readonly="readonly" placeholder="用户名" />
			</div>
			<div class="form-group form-control-medium">
				<label for="mobile">手机号：</label>
				<input id="mobile" name="mobile" type="text" th:value="${user.mobile}" class="form-control" placeholder="手机号" />
			</div>
			<div class="form-group form-control-medium">
				<label for="realname">真实姓名：</label>
				<input id="realname" name="realname" type="text" th:value="${user.realname}" class="form-control" placeholder="真实姓名" />
			</div>
			<div class="form-group form-control-medium">
				<label for="status">状态：</label>
				<input id="status-yes" name="status" type="radio" value="1" th:checked="${user.status} == 1" /> 有效
				<input id="status-no" name="status" type="radio" value="0" th:checked="${user.status} == 0" /> 无效
			</div>
			<div class="form-btn-group-left" shiro:hasAnyPermissions="system:user:toedit,system:user:update">
            	<button type="submit" class="btn btn-info">保存</button>
            </div>
		</form>
	</div>
</section>
<script src="/resource/js/jquery.min.js"></script>
<script src="/resource/js/coco-message/coco-message.js"></script>
<script th:inline="javascript">
   	/* 保存方法 */
    function validateForm(){
    	var username = $("#username").val();
    	if(username == null || username==''){
    		cocoMessage.error("用户名不能为空");
    		return false;
    	}
    	return true;
    }
</script>
</body>
</html>
